package algorithm.poj.p1000;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLDecoder;
import java.text.DecimalFormat;
import java.text.Format;
import java.util.StringTokenizer;

/**
 * 分析：
 * 
 * 实现：
 * 
 * 经验：
 * 
 * 教训：
 * 
 * @author wong.tong@gmail.com
 *
 */
public class P1799 {

	@SuppressWarnings("unchecked")
	public static void main(String[] args) throws Exception {

		InputStream input = null;
		if (false) {
			input = System.in;
		} else {
			URL url = P1799.class.getResource("P1799.txt");
			File file = new File(URLDecoder.decode(url.getPath(), "UTF-8"));
			input = new FileInputStream(file);
		}
		
		BufferedReader stdin = new BufferedReader(new InputStreamReader(input));

		Format fmt = new DecimalFormat("##0.000");
		String line = stdin.readLine();
		int N = Integer.valueOf(line);
		for (int i = 0; i < N; i ++) {
			StringTokenizer st = new StringTokenizer(stdin.readLine());
			double R = Double.valueOf(st.nextToken());
			int n = Integer.valueOf(st.nextToken());
			//r/(R-r) = sin(pi/n)
			double s = Math.sin(Math.PI/n);
			double r = s*R/(1+s);
			System.out.println("Scenario #" + (i+1) + ":\n" + fmt.format(r)+"\n");
		}
	}
}